From 5b99ce41a35e7ddd0d4681990613ec9195a5acc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz?= <lukasz@czak.pl>
Date: Thu, 7 May 2020 11:54:26 +0200
Subject: [PATCH 2/3] Use 340000 as fallback max_tmds_clock

If connector->display_info->max_tmds_clock is 0, fall back to 340000.

If it is > 0 though, shouldn't it take priority, and instead of max be
`min(info->max_tmds_clock, 165000)`?
---
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index 955fc3cf4..f95cdc53a 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -220,14 +220,17 @@ dw_hdmi_rockchip_mode_valid(struct drm_connector *connector,
 			    const struct drm_display_mode *mode)
 {
 	struct drm_display_info *info = &connector->display_info;
-	int max_tmds_clock = max(info->max_tmds_clock, 165000);
+	int max_tmds_clock = info->max_tmds_clock > 0 ?
+				     max(info->max_tmds_clock, 165000) :
+				     340000;
+
 	int clock = mode->clock;
 
 	if (connector->ycbcr_420_allowed && drm_mode_is_420(info, mode) &&
 	    (info->color_formats & DRM_COLOR_FORMAT_YCRCB420))
 		clock /= 2;
 
-	if (clock > max_tmds_clock || clock > 340000)
+	if (clock > max_tmds_clock)
 		return MODE_CLOCK_HIGH;
 
 	return MODE_OK;
-- 
2.26.2

